"""
Pydantic 模型定义
"""

from pydantic import BaseModel, Field


class Page(BaseModel):
    page: int = Field(default=1, description="页码")
    page_size: int = Field(default=10, description="每页数据量")

    def limit(self):
        """限制返回数量"""
        return self.page_size

    def skip(self):
        """跳过数量"""
        return (self.page - 1) * self.page_size


class PageResult(Page):
    total: int = Field(description="总数")
